import api from "../api/index";
import Axios from '../utils/axios'

// 数据接口
export interface queryNotice {
    messageTitle?: string;
    limit?: number;
    page?: number;
    createTime?: string | Date;
    message?: string;
    id?: number;
    deleted?: number;
    adminId?: number;
}

// 查询全部
function select() {
    return Axios.get(api.settings.NOTICE_SELECT)
}

// 查询函数
function query(obj: queryNotice) {
    return Axios.get(api.settings.NOTICE_QUERY, { params: obj })
}

// 添加函数
function insert(obj: queryNotice) {
    return Axios.post(api.settings.NOTICE_INSERT, obj)
}

// 修改函数
function update(obj: queryNotice) {
    return Axios.post(api.settings.NOTICE_UPDATE, obj)
}

// 删除函数
function deleted(id: number) {
    return Axios.post(api.settings.NOTICE_DELETE_ID + `?id=${id}`)
}

// 根据id回显
function getById(id: any) {
    return Axios.post(api.settings.NOTICE_GET_BY_ID + id)
}


export default {
    query,
    select,
    insert,
    deleted,
    update,
    getById
}